package com.leetcode.LC;

public class LC231 {
    public boolean isPowerOfTwo(int n) {

        if (n == 0) {
            return false;
        }

        while (n != 0) {
            if (n == 1) {
                return true;
            } else if (n % 2 != 0) {
                return false;
            }
            n = n / 2;
        }
        return true;
    }

    public static void main(String[] args) {
        System.out.println(new LC231().isPowerOfTwo(32));
    }
}
